home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3103 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is it possible to #include <#defined or -D 'ed macro>?
  5. Date: 26 Jan 1996 03:26:44 GMT
  6. Organization: Los Alamos National Laboratory
  7. Distribution: world
  8. Message-ID: <TANMOY.96Jan25202644@qcd.lanl.gov>
  9. References: <5rbuntgqp0.fsf@ritz.mordor.com> <4e8ap3$901@info1.sdrc.com>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: larry.jones@sdrc.com's message of 25 Jan 1996 16:22:59 GMT
  14.  
  15. --text follows this line--
  16. In article <4e8ap3$901@info1.sdrc.com> larry.jones@sdrc.com (Larry
  17. Jones) writes: 
  18. <snip>
  19.    #include SOURCE
  20.  
  21.    cc -D SOURCE='<source_a.h>'
  22.    cc -D SOURCE='<source_b.h>'
  23.  
  24.    should work on any ANSI conforming compiler.
  25.  
  26. Almost. How the token sequence between < and > is interpreted as a
  27. header name pp-token is implementation defined. Notice that using a
  28. macro in an include line results in a token sequence, and not <
  29. h-char-sequence > which can be converted to a header-name q-char
  30. sequence without implementation dependence.
  31.  
  32. I agree however that an implementation should do the obvious.
  33.  
  34. (And of course, ANSI says nothing about compiler switches :-)
  35.  
  36. By the way, if you have read my other post and wondering what in the
  37. standard confused me about the stringized version, the problem is that
  38. the standard says that after expansion the line is supposed to look
  39. like #include followed by a ", a q-char-sequence and another ", the
  40. last three therefore forming a header name. Of course, this can never
  41. happen since after expansion, what you get is #include followed by a
  42. string literal: and a string literal is not a header name (for
  43. example, one can't use \ portably within a header name, but one can
  44. inside a string literal). This is probably a mistake in the standard
  45. as is clear from a footnote.
  46.  
  47. Cheers
  48. Tanmoy
  49. --
  50. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  51. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  52. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  53. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  54. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  55. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  56.